package com.lesama.stringbuilder;

public class StringBuilderDemo1 {
    public static void main(String[] args) {
        // method();
        method2();
    }
    public static void method2() {
        StringBuilder stringBuilder = new StringBuilder();
        long start = System.currentTimeMillis();
        for (int i = 0; i < 100000; i++) {
            stringBuilder.append(i);
        }
        System.out.println(stringBuilder);
        long end = System.currentTimeMillis();
        System.out.println(end - start);
    }
    public static void method() {
        long start = System.currentTimeMillis();
        String s = "";
        for (int i = 0; i < 100000; i++) {
            s += i;
        }
        System.out.println(s);
        long end = System.currentTimeMillis();
        System.out.println(end - start);

    }
}
